package com.nba.dao.impl;

import java.util.Date;
import java.util.List;

import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import com.nba.bean.Admin;
import com.nba.bean.Atlas;
import com.nba.dao.AtlasDao;
import com.nba.util.DBUtil;

public class AtlasDaoImpl implements AtlasDao {
		
	JdbcTemplate jt = new JdbcTemplate(DBUtil.getDataSource());
	
	@Override
	public List<Atlas> selectAtlasAll() {
		String sql = "SELECT * FROM atlas";
		List<Atlas> list = jt.query(sql, new BeanPropertyRowMapper<Atlas>(Atlas.class));
		return list;
	}

	@Override
	public int insertAtlas(String atlasTheme, String atlasContent, String atlasUrl, Date atlasTime, int typeId) {
		String sql = "INSERT INTO atlas(atlas_theme , atlas_content , atlas_url , atlas_time,type_id) Value(?,?,?,?,?)";
		return jt.update(sql,atlasTheme, atlasContent, atlasUrl, atlasTime, typeId);
	}

}
